#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    int cnt; cin >> cnt;
    vector<int> arr;
    for (int i = 0; i < cnt; i++) {
        int curr; cin >> curr;
        arr.push_back(curr);
    }
    sort(arr.begin(), arr.end());
    int result = __INT32_MAX__;
    for (int i = 0; i < arr.size() - 1; i++) {
        int sub = abs(arr[i] - arr[i + 1]);
        result = sub < result ? sub : result;
    }
    cout << result;
    return 0;
}